# name : Loop through Dates Using a Macro %DO Loop
# key : date.loop.macro
# contributor: Shuguang Sun
# --
%macro date_loop(start,end);
  %let start=%sysfunc(inputn(&start, anydtdte9.));
  %let end=%sysfunc(inputn(&end, anydtdte9.));
  %let dif=%sysfunc(intck(month, &start, &end));
    %do i=0 %to &dif;
     %let date=%sysfunc(intnx(month, &start, &i, b), date9.);
     %put &date;
    %end;
  %mend date_loop;

%date_loop(01jul2015,01feb2016)